package com.sanen.flyer.entity;

import com.sanen.flyer.entity.blast.Blast;
import com.sanen.flyer.entity.hero.Hero;
import com.sanen.flyer.factory.BlastFactory;
import com.sanen.flyer.tool.ImageTool;

import java.awt.*;

/**
 * @author wsse
 * @date 2018-09-19 18:11
 */
public abstract class Bullet extends FlyObject{
    protected Hero hero;

    @Override
    public void draw(Graphics g) {
        super.draw(g);
        ImageTool.rotate(g, ImageTool.getTheta(speedx, speedy, orientation ), x + width / 2, y + height / 2, ()-> {
            g.drawImage(image,x,y,width,height,null);
        });
    }
    public boolean byHit(Bullet o){
        if (x+width-paddingR<o.getX()+o.getPaddingL()||x+paddingL>o.getX()+o.getWidth()-o.getPaddingR()
                ||y+height-paddingB<o.getY()+o.getPaddingT()||y+paddingT>o.getY()+o.getHeight()-o.getPaddingB()){
            return false;
        }
        return true;
    }
    public Blast getBlast(){
        return null;
    }
}
